<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">

    <ui:define name="body">

        <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>

        <h:form id="trait" styleClass="edit">

            <rich:panel>
                <f:facet name="header">#{messages['trait.label']}</f:facet>

                <s:decorate id="numberDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">#{messages['trait.number']}</ui:define>
                    <h:inputText id="number" size="10" maxlength="40" required="true"
                                 value="#{traitHome.instance.number}"/>
                </s:decorate>

                <s:decorate id="nameDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">#{messages['trait.name']}</ui:define>
                    <h:inputText id="name" size="40" maxlength="40" required="true"
                                 value="#{traitHome.instance.name}"/>
                </s:decorate>


                <s:decorate id="failsDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">#{messages['trait.failsexpectations']}</ui:define>
                    <h:inputTextarea id="failsExpectations" required="true"
                                     value="#{traitHome.instance.failsExpectations}"
                                     rows="10" cols="50"/>
                </s:decorate>
                <s:decorate id="meetsDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">#{messages['trait.meetsexpectations']}</ui:define>
                    <h:inputTextarea id="failsExpectations" required="true"
                                     value="#{traitHome.instance.meetsExpectations}"
                                     rows="10" cols="50"/>
                </s:decorate>
                <s:decorate id="exceedsDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">#{messages['trait.exceedsexpectations']}</ui:define>
                    <h:inputTextarea id="exceedsExpectations" required="true"
                                     value="#{traitHome.instance.exceedsExpectations}"
                                     rows="10" cols="50"/>
                </s:decorate>

                <div style="clear:both">
                    <span class="required">*</span>
                    #{messages['javax.faces.component.UIInput.REQUIRED']}
                </div>

            </rich:panel>

            <div class="actionButtons">

                <h:commandButton id="save"
                                 value="#{messages['button.save']}"
                                 action="#{traitHome.persist}"
                                 disabled="#{!traitHome.wired}"
                                 rendered="#{!traitHome.managed}"/>

                <h:commandButton id="update"
                                 value="#{messages['button.update']}"
                                 action="#{traitHome.update}"
                                 rendered="#{traitHome.managed}"/>

                <h:commandButton id="delete"
                                 value="#{messages['button.delete']}"
                                 action="#{traitHome.remove}"
                                 immediate="true"
                                 rendered="#{traitHome.managed}"/>

                <s:button id="done"
                          value="#{messages['button.done']}"
                          propagation="end"
                          view="/trait.xhtml"
                          rendered="#{traitHome.managed}"/>

                <s:button id="cancel"
                          value="#{messages['button.cancel']}"
                          propagation="end"
                          view="/#{empty traitFrom ? 'traitList' : traitFrom}.xhtml"
                          rendered="#{!traitHome.managed}"/>

            </div>
        </h:form>
    </ui:define>

</ui:composition>